package com.zx.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author Zx
 * @date 2021/2/22 17:17
 * @modified By:
 */
@RestController
public class OrderController {
    @Value("${server.port}")
    private String serverPort;
    @Value("${server-url.nacos-user-server}")
    private String serverUrl;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping(value = "/consumer/nacos/test/{string}")
    public String order(@PathVariable String string) throws Exception {
        return restTemplate.getForObject(serverUrl + "/echo/" + string, String.class);
    }
}